#include<iostream>
#include<stdlib.h>
using namespace std;
class Test
{
public:
   Test()
       : _data(0)
   {
       ptr = (char*)malloc(sizeof(Test));
       cout << "Test():" << this << endl;
   }
   ~Test()
   {
       if (ptr)
       {
           free(ptr);
           ptr = nullptr;
       }
       cout << "~Test():" << this << endl;
   }

private:
   int _data;
   char* ptr;
};


void Test2()
{
   // 申请单个Test类型的对象
   Test* p1 = new Test;
   delete p1;

   // 申请10个Test类型的对象
   Test* p2 = new Test[10];
   delete[] p2;
}

int main()
{
  
   Test2();
   return 0;
}